package com.deyuanyun.pic.web.timedtask;

import com.deyuanyun.pic.common.spring.SpringAppliction;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created by xu on 2016/1/26.
 */
public class TaskPool {
    public static ThreadPoolTaskExecutor threadPoolTaskExecutor;

    //坐标转换任务需要跑的跑
    public final static BlockingQueue<TaskTableInfo> coordTaskTable =new ArrayBlockingQueue<>(20);
    //坐标转换任务需要跑记录
    public final static BlockingQueue<TaskTableInfo> coordTaskTableRecords=new ArrayBlockingQueue<>(3000);

    static {
        threadPoolTaskExecutor = (ThreadPoolTaskExecutor) SpringAppliction.getBean("postTaskExecutor",ThreadPoolTaskExecutor.class);
        ThreadPoolExecutor t=threadPoolTaskExecutor.getThreadPoolExecutor();
        t.setThreadFactory(new HandlerThreadFactory());
    }
}


